package edu.vt.ece3574.ninjatag;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class no_internet_screen extends Activity implements OnClickListener{
	@Override
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.no_internet_screen);
        ((Button)findViewById(R.id.buttonLogin)).setOnClickListener(this);
	}

	/*
	 *	The next couple methods are used to override the menu and back physical buttons on the phone.
	 *	onCreateOptionsMenu sets the menu to the custom 'main_menu'
	 *	onOptionsItemSelected starts an activity based on the selected option in the menu
	 * 	onBackPressed sends the app to the previous screen.
	 * 		-disabled on this screen
	 */
	
    @Override
	public void onBackPressed(){

		return;
	}
    @Override
    public boolean onCreateOptionsMenu(Menu menu){
    	MenuInflater inflater = getMenuInflater();
    	inflater.inflate(R.menu.main_menu, menu);
    	return true;
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
    	
    	switch(item.getItemId() ){
    	
    	case R.id.menu_home:
    		Intent mainScreenIntent = new Intent(no_internet_screen.this, main_screen.class);
    		startActivity(mainScreenIntent);
    		finish();
    		break;
    	
    	case R.id.menu_map:
    		Intent mapScreenIntent = new Intent(no_internet_screen.this, map_screen.class);
    		startActivity(mapScreenIntent);
    		finish();
    		break;
    		
    	case R.id.gps_settings:
    		Intent GPS_ActivityIntent = new Intent(no_internet_screen.this, GPS_Activity.class);
    		startActivity(GPS_ActivityIntent);
    		finish();
    		break;
    		
    	case R.id.menu_settings:
    		Intent settingsScreenIntent = new Intent(no_internet_screen.this, settings_screen.class);
    		startActivity(settingsScreenIntent);
    		finish();
    		break;
    	}
    	return true;
    }
	@Override
	public void onClick(View v) {
		
		switch(v.getId()) {
		
		case R.id.buttonLogin:
			retryClick(v);
			break;
		}
		
	}
	
	private void retryClick(View v) {
		Intent retryintent = new Intent(this,NinjaTagActivity.class);
		startActivity(retryintent);
		finish();
		
	}
}
